const express = require('express')
const router = express.Router()
const { submitUserInfo, getUserInfo, changeUserPwd, uploadUserAvatar } = require('../../controller/web/userController')

// 导入JWT拦截中间件
const checkTokenMiddleware = require('../../middlewares/checkTokenMiddleware')

// 提交用户个人信息
router.patch('/user', checkTokenMiddleware, submitUserInfo)

// 获取用户个人信息
router.get('/user/:id', checkTokenMiddleware, getUserInfo)

// 修改用户密码
router.patch('/user/pwd/:id', checkTokenMiddleware, changeUserPwd)

// 上传管理员头像
router.post('/user/avatar/upload', checkTokenMiddleware, uploadUserAvatar)

module.exports = router